package wxshop.service.admin.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wxshop.api.admin.dao.SystemDao;
import wxshop.api.admin.exception.OperationFail;
import wxshop.api.admin.model.Admin;
import wxshop.api.admin.model.FormResult;
import wxshop.api.admin.model.LevelUpRules;
import wxshop.api.admin.model.PriceRules;
import wxshop.api.admin.service.SysManageService;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service

public class SysManageServiceImpl implements SysManageService {
    @Autowired
    private SystemDao systemDao;
    @Override
    public FormResult selectAllAdmin() {
        return new FormResult(true,systemDao.selectAdmin());
    }

    @Override
    public FormResult updateAccessByid(int id,int roleid) {
        int judge = systemDao.updateAdminAccessById(id, roleid);
        if(judge ==1){
            return new FormResult(true);
        }else {
            throw new OperationFail();
        }
    }

    @Override
    public FormResult deleteSysAdminById(Admin admin) {
        return null;
    }

    @Override
    public FormResult selectAccessList() {
        return new FormResult(systemDao.selecAccessList());
    }

    @Override
    public FormResult insertPriceRules(PriceRules priceRules) {
        return null;
    }

    @Override
    public FormResult updatePriceRules(PriceRules priceRules) {
        return null;
    }

    @Override
    public FormResult deletePriceRulesById(PriceRules priceRules) {
        return null;
    }

    @Override
    public FormResult selectPriceRules() {
        return new FormResult(systemDao.selectPriceRules());
    }

    @Override
    public FormResult insertLevelUpRules(LevelUpRules levelUpRules) {
        return null;
    }

    @Override
    public FormResult updateLevelUpRulesBy(LevelUpRules levelUpRules) {
        return null;
    }

    @Override
    public FormResult deleteLevelUpRulesById(LevelUpRules levelUpRules) {
        return null;
    }

    @Override
    public FormResult selectLevelUpRules() {

        return new FormResult(systemDao.selectLevelUpRules());
    }
}
